import java.util.HashMap;

/**
 * Created by zhangjinrui on 17/6/27.
 */

public class Solution299 {

    public static void main(String args[]){
        Solution299 s = new Solution299();
        System.out.println(s.getHint("11","10"));
    }

    public String getHint(String secret, String guess) {
        int a = 0;
        int b = 0;
        HashMap<Character, Integer> mp = new HashMap<>();
        int[] gmp = new int[guess.length()];
        for(int i = 0; i < secret.length(); i ++){
            char c = secret.charAt(i);
            mp.put(c, !mp.containsKey(c) ? 1: mp.get(c) + 1);
            if(c == guess.charAt(i)){
                a ++;
                mp.put(c, mp.get(c) - 1);
                gmp[i] = 1;
            }
        }
        for(int i = 0 ; i < guess.length() ; i ++){
            char c = guess.charAt(i);
            if(mp.containsKey(c) && mp.get(c) > 0 && gmp[i] == 0){
                b ++;
                mp.put(c, mp.get(c) - 1);
            }
        }
        return a + "A" + b + "B";
    }

}
